#ifndef RSIM_BALLCONSTRAINT_H
#define RSIM_BALLCONSTRAINT_H

/* -------------------------------------------------------------------------- *
 * File: BallConstraint.h                                                     *
 * Authors: Kishor Bhalerao                                                   *
 * Email : kishor8dm@gmail.com                                                *
 * Contributors:                                                              *
 * Email:                                                                     *
 * copyright (c) 2010 Authors.                                                *
 *                                                                            *
 * This program is free software: you can redistribute it and/or modify it    *
 * under the terms of the GNU General Public License as published by the Free *
 * Software Foundation, either version 3 of the License, or any later version.*
 *                                                                            *
 * This program is distributed in the hope that it will be useful, but        *
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *
 * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License   *
 * for more details. (http://www.gnu.org/licenses/)                           *
 * -------------------------------------------------------------------------- */

#include "Constraint.h"

namespace RSIM{
        
class Transform;
class SystemData;
class MultibodySystem;
class State;

class BallConstraint:public Constraint{
        private:
                // This contructor is illegal
                BallConstraint();
        public:
                BallConstraint(	const Transform& T_PM, MultibodySystem *Parent, const int& ParentNodeId,
                                const Transform& T_BF, MultibodySystem *Child, const int& ChildNodeId, 
                                const int& Constraint_ID,State *pstate, State *cstate)
                                :Constraint(T_PM,Parent,ParentNodeId,T_BF,Child,ChildNodeId, Constraint_ID,pstate,cstate){}
                
                int getNAlgebraicConstraints()const{return 3;}
                
                /** True if the derived class results in constraints on the angular velocity
                of connected bodies*/
                bool imposeConstraintOnAngularVelocity()const{return false;}
                
                /** True if the derived class results in constraints on the linear velocity
                of connected bodies*/
                bool imposeConstraintOnLinearVelocity()const{return true;}                
                
                bool areOriginsOfFramesMAndFCoincident()const{return true;}
                
                void calcPositionLevelError();
                
                void calcConstraintJacobian(const int& ctoumap, Matrix *CJac)const;
}; // class BallConstraint

} // namespace RSIM

#endif